<%@ page isELIgnored="false" language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<script type="text/javascript">
function _closeWindow(){
	$('#_changePass').window('close');
}
function _changePass(){
	var r = $('#_changePassForm').form('validate');
	if(!r) {
		return false;
	}
	$.post("user/changePassword",$("#_changePassForm").serializeArray(),function(data){
		if(data.result == 'succ'){
			$.messager.alert('提示',"密码修改成功!",'info');
			_closeWindow();
		}else{
			$('#_tipMsg').html("原密码输入错误!");
		}
	});
}

var npass = null;
$.extend($.fn.validatebox.defaults.rules, {
    loadVal: {
        validator: function(value){
        	npass = value;
            return true;
        },
        message: '结束日期应该大于开始日期!'
    }
});
$.extend($.fn.validatebox.defaults.rules, {
    eq: {
        validator: function(value){
            return (value == npass);
        },
        message: '两次密码输入不一致!'
    }
});
</script>
<div id="retItem">
<form id="_changePassForm" method="post" style="margin: 10;text-align: center;">
<span id="_tipMsg"></span>
<table >
	<tr>
		<td>原密码：</td>
		<td><input type="password" name="opass" class="easyui-validatebox" required="true" style="width:200px;"/></td>
	</tr>
	<tr>
		<td>新密码：</td>
		<td><input type="password" validType="loadVal" name="npass" class="easyui-validatebox" required="true" style="width:200px;"/></td>
	</tr>
	<tr>
		<td>再次输入：</td>
		<td><input type="password" validType="eq" name="rpass" class="easyui-validatebox" required="true" style="width:200px;"/></td>
	</tr>
</table>
<a href="javascript:void(0);" id="btn-back" onclick="_closeWindow();" class="easyui-linkbutton" iconCls="icon-back">返回</a>
<a href="javascript:void(0);" id="btn-add" onclick="_changePass();" class="easyui-linkbutton" iconCls="icon-save">保存</a>
</form>
</div>
